/*****************************************************
** Author:
** Date: 2019-07-25
*
*****************************************************/

#ifndef __ADS1256_REG_H_
#define __ADS1256_REG_H_

#ifdef __cplusplus
extern "C"{
#endif

enum
{
    /*
     *  Register address, followed by reset the default values
     */
    ADS1256_REG_STATUS = 0x00, // x1H
    ADS1256_REG_MUX    = 0x01, // 01H
    ADS1256_REG_ADCON  = 0x02, // 20H
    ADS1256_REG_DRATE  = 0x03, // F0H
    ADS1256_REG_IO     = 0x04, // E0H
    ADS1256_REG_OFC0   = 0x05, // xxH
    ADS1256_REG_OFC1   = 0x06, // xxH
    ADS1256_REG_OFC2   = 0x07, // xxH
    ADS1256_REG_FSC0   = 0x08, // xxH
    ADS1256_REG_FSC1   = 0x09, // xxH
    ADS1256_REG_FSC2   = 0x0A, // xxH
};

enum
{
    ADS1256_CMD_WAKEUP   = 0x00, // Completes SYNC and Exits Standby Mode 0000  0000 (00h)
    ADS1256_CMD_RDATA    = 0x01, // Read Data 0000  0001 (01h)
    ADS1256_CMD_RDATAC   = 0x03, // Read Data Continuously 0000   0011 (03h)
    ADS1256_CMD_SDATAC   = 0x0F, // Stop Read Data Continuously 0000   1111 (0Fh)
    ADS1256_CMD_RREG     = 0x10, // Read from REG rrr 0001 rrrr (1xh)
    ADS1256_CMD_WREG     = 0x50, // Write to REG rrr 0101 rrrr (5xh)
    ADS1256_CMD_SELFCAL  = 0xF0, // Offset and Gain Self-Calibration 1111    0000 (F0h)
    ADS1256_CMD_SELFOCAL = 0xF1, // Offset Self-Calibration 1111    0001 (F1h)
    ADS1256_CMD_SELFGCAL = 0xF2, // Gain Self-Calibration 1111    0010 (F2h)
    ADS1256_CMD_SYSOCAL  = 0xF3, // System Offset Calibration 1111   0011 (F3h)
    ADS1256_CMD_SYSGCAL  = 0xF4, // System Gain Calibration 1111    0100 (F4h)
    ADS1256_CMD_SYNC     = 0xFC, // Synchronize the A/D Conversion 1111   1100 (FCh)
    ADS1256_CMD_STANDBY  = 0xFD, // Begin Standby Mode 1111   1101 (FDh)
    ADS1256_CMD_RESET    = 0xFE, // Reset to Power-Up Values 1111   1110 (FEh)
};

enum
{
    ADS1256_GAIN_1  = 0x0,  /* GAIN   1 */
    ADS1256_GAIN_2  = 0x1,  /* GAIN   2 */
    ADS1256_GAIN_4  = 0x2,  /* GAIN   4 */
    ADS1256_GAIN_8  = 0x3,  /* GAIN   8 */
    ADS1256_GAIN_16 = 0x4,  /* GAIN  16 */
    ADS1256_GAIN_32 = 0x5,  /* GAIN  32 */
    ADS1256_GAIN_64 = 0x6,  /* GAIN  64 */
    ADS1256_GAIN_MAX,
};

enum
{
    ADS1256_DRATE_30000SPS = 0,
    ADS1256_DRATE_15000SPS,
    ADS1256_DRATE_7500SPS,
    ADS1256_DRATE_3750SPS,
    ADS1256_DRATE_2000SPS,
    ADS1256_DRATE_1000SPS,
    ADS1256_DRATE_500SPS,
    ADS1256_DRATE_100SPS,
    ADS1256_DRATE_60SPS,
    ADS1256_DRATE_50SPS,
    ADS1256_DRATE_30SPS,
    ADS1256_DRATE_25SPS,
    ADS1256_DRATE_15SPS,
    ADS1256_DRATE_10SPS,
    ADS1256_DRATE_5SPS,
    ADS1256_DRATE_2D5SPS,
    ADS1256_DRATE_MAX,
};

enum
{
    ADS1256_AIN0   = 0,     //Binary value: 0000 0000
    ADS1256_AIN1   = 1,     //Binary value: 0000 0001
    ADS1256_AIN2   = 2,     //Binary value: 0000 0010
    ADS1256_AIN3   = 3,     //Binary value: 0000 0011
    ADS1256_AIN4   = 4,     //Binary value: 0000 0100
    ADS1256_AIN5   = 5,     //Binary value: 0000 0101
    ADS1256_AIN6   = 6,     //Binary value: 0000 0110
    ADS1256_AIN7   = 7,     //Binary value: 0000 0111
    ADS1256_AINCOM = 8,     //Binary value: 0000 1000
};


#ifdef __cplusplus
}
#endif

#endif /* __ADS1256_REG_H_ */

